package com.itheima.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @作者 itcast
 * @创建日期 2020/11/2 10:41
 **/
//@RestController
public class ConfigController {
    @Value("${name}")
    String name;

    @Value("${person.name}")
    String personName;

    @Value("${city[0]}")
    String cityFirst;

    @Autowired
    Environment environment;  // spring中提供的环境对象

    @Autowired
    ConfigModel configModel;


    @RequestMapping("hello")
    public String hello(){

        System.out.println(configModel);

        return "name==>"+name + " personName==> "+personName   + "  cityFirst=="+cityFirst;
    }
}
